* Removes a bookmark. bkmk can be either the index in bookmarkArray or a url. If refresh is true the quicksearch command is sent to all observers(such as the GMarks sidebar)
* returns the id of the bookmark removed [The bookmark's id is the only parameter taken by Google in order to delete a bookmark]
*/
removeBookmark: function(bkmk,refresh){
var idx=typeof bkmk=='number'?bkmk:this.isBookmarked(bkmk.url);
if (idx>=0) {
this.removeFromRecent(this.bookmarkArray[idx]);
this.removeFromFrequent(this.bookmarkArray[idx]);
var id=this.bookmarkArray[idx].id;
var url=this.bookmarkArray[idx].url;
this.bookmarkArray.splice(idx,1);
this.doCommand('url-removed',url);
if (refresh) this.doCommand("quickrefresh");
return id;
}
else
return null;
},
/*
* Adds a bookmark to the bookmarkArray
*/
addBookmark: function(bkmk,refresh){
var idx=this.getBookmarkIndex(bkmk);
if (idx<0){
idx=-(idx+1)
this.bookmarkArray.splice(idx,0,bkmk);
}
else if (this.bookmarkArray.length==0 || (idx==0 && this.bookmarkArray[0].url!=bkmk.url)){
this.bookmarkArray.splice(0,0,bkmk);
}
this.updateRecent(bkmk)
if (!this.loading)
this.doCommand("url-added",bkmk.url);
if (refresh) this.doCommand("quickrefresh");
return idx;
},
/*
* Updates a bookmark's details and updates the date in the bookmarkArray.
* Does NOT submit an update to Google(or any other site)